package com.ym.b2b.payment.controller.bocPay;

import java.io.Serializable;
import java.net.URL;

import org.apache.commons.lang.StringUtils;

import com.ym.b2b.payment.controller.bocPay.util.Constants;


public class BOCV1Params implements Serializable {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1150701182854288488L;

	private String serverUrl; 		// 网关地址
	
	private String merchantNo;		//商户号
	
	private String backNotifyUrl;	//商户通知回调URl
	
	private String currency;		//交易币种
	
	private String signKeyFile;		//签名证书
	
	private String signkeyPassword;	//签名密码
	
	private String verifyCerFile;	//解密证书
	
	private String version;		//版本号
	
	private String security;	//加密方式
	
	
	
	private String orderNo;
	
	private String amount;
	
	private String orderTime;
	
	private String orderNote;
	
	private String closeTime;
	
	private String subMerchantInfo;

	public void setColumProperty(BOCParam bocParamBean){
		this.setAmount(bocParamBean.getOrderAmount());
		this.setOrderNo(bocParamBean.getOrderNo());
		this.setOrderNote(bocParamBean.getOrderNote()+"-订单号码-"+bocParamBean.getOrderNo());
	}
	

	
	
	public String getServerUrl() {
		return serverUrl;
	}

	public void setServerUrl(String serverUrl) {
		this.serverUrl = serverUrl;
	}

	public String getMerchantNo() {
		if(StringUtils.isEmpty(merchantNo)){
			return   "7298";
		}
		return merchantNo;
	}

	public void setMerchantNo(String merchantNo) {
		this.merchantNo = merchantNo;
	}

	public String getBackNotifyUrl() {
		return backNotifyUrl;
	}

	public void setBackNotifyUrl(String backNotifyUrl) {
		this.backNotifyUrl = backNotifyUrl;
	}

	public String getCurrency() {
		return currency;
	}

	public void setCurrency(String currency) {
		this.currency = currency;
	}

	public String getOrderNo() {
		return orderNo;
	}

	public void setOrderNo(String orderNo) {
		this.orderNo = orderNo;
	}

	public String getAmount() {
		return amount;
	}

	public void setAmount(String amount) {
		this.amount = amount;
	}

	public String getOrderTime() {
		return orderTime;
	}

	public void setOrderTime(String orderTime) {
		this.orderTime = orderTime;
	}

	public String getOrderNote() {
		return orderNote;
	}

	public void setOrderNote(String orderNote) {
		this.orderNote = orderNote;
	}

	public String getCloseTime() {
		return closeTime;
	}

	public void setCloseTime(String closeTime) {
		this.closeTime = closeTime;
	}

	public String getSubMerchantInfo() {
		return subMerchantInfo;
	}

	public void setSubMerchantInfo(String subMerchantInfo) {
		this.subMerchantInfo = subMerchantInfo;
	}




	public String getSignKeyFile() {
		String path = this.getClass().getClassLoader().getResource("").getPath();
		System.out.println(path+"/boc-conf/boc.cer");
		if(StringUtils.isEmpty(signKeyFile)){
			
			return  path+"/boc-conf/boc.pfx";
		}
		return path+"/"+signKeyFile;
	}




	public void setSignKeyFile(String signKeyFile) {
		this.signKeyFile = signKeyFile;
	}




	public String getSignkeyPassword() {
		if(StringUtils.isEmpty(signkeyPassword)){
			return "boc111111";
		}
		return signkeyPassword;
	}




	public void setSignkeyPassword(String signkeyPassword) {
		this.signkeyPassword = signkeyPassword;
	}




	public String getVerifyCerFile() {
		String path = this.getClass().getClassLoader().getResource("").getPath();
		if(StringUtils.isEmpty(verifyCerFile)){
			return  path+"/boc-conf/boc.cer";
		}
		return path+"/"+ verifyCerFile;
	}

public static void main(String[] args) {
	BOCV1Params a = new BOCV1Params();
	System.out.println(a.getVerifyCerFile());
}


	public void setVerifyCerFile(String verifyCerFile) {
		this.verifyCerFile = verifyCerFile;
	}




	public String getVersion() {
		if(StringUtils.isEmpty(version)){
			return Constants.B2B_DIRECT_VERSION;
		}
		return version;
	}




	public void setVersion(String version) {
		
		this.version = version;
	}




	public String getSecurity() {
		if(StringUtils.isEmpty(security)){
			return Constants.SECURITY;
		}
		return security;
	}




	public void setSecurity(String security) {
		this.security = security;
	}
	
	
}
